<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->

  <title>E+酒店管理系统</title>

  <!-- Bootstrap core CSS -->
  <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

  <!-- Custom styles for this template -->
  <link href="/static/css/dashboard.css" rel="stylesheet">
  <link href="/static/css/navBar.css" rel="stylesheet">
  <script src="https://cdn.bootcss.com/d3/3.2.1/d3.js"></script>
  <script src="/static/js/dashboard.js"></script>
  <script src="/static/js/navOptions.js"></script>
  <script src="/static/js/navBar.js"></script>
</head>

<body>
  <nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
          aria-expanded="false" aria-controls="navbar">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="#">E+酒店管理系统</a>
      </div>
      <div id="navbar" class="navbar-collapse collapse">
        <ul class="nav navbar-nav navbar-right">
          <li><a href="#">入住管理</a></li>
          <li><a href="#">信息查询</a></li>
          <li><a href="#">楼层管理</a></li>
          <li><a href="#">系统设置</a></li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
              aria-expanded="false">{{user.username}}<span class="caret"></span></a>
            <ul class="dropdown-menu">
              <li><a href="#">个人信息</a></li>
              <li><a href="#">修改密码</a></li>
              <li role="separator" class="divider"></li>
              <li><a href="/logout">注销</a></li>
            </ul>
          </li>
        </ul>
        <form class="navbar-form navbar-right">
          <input type="text" class="form-control" placeholder="Search...">
        </form>
      </div>
    </div>
  </nav>

  <div class="container-fluid">

    <div class="row">
        <div class="navBarOut">
          <div class="navBar">
            <ul class="navBar_ul" style="height: 738px;">
              <li id="page3"><a class="first_nav_name" onclick="navSwitchShowmore('page3')"><span>入住管理</span><img
                    src="static/img/show-more.png" class="showMore"></a>
                <ul class="secNavBar_ul">
                  <li><a id="page3_2" class="second_nav_name {% if active == 0 %}active{%endif%}" href="#32">入住登记</a></li>
                  <li><a id="page3_2" class="second_nav_name" href="#32">房间预订</a></li>
                  <li><a id="page3_2" class="second_nav_name" href="#32">申请退房</a></li>
                  <li><a id="page3_2" class="second_nav_name {% if active == 0 %}active{%endif%}" href="#32">查询空房</a></li>
                </ul>
              </li>
              <li id="page5"><a class="first_nav_name" onclick="navSwitchShowmore('page5')"><span>信息查询</span><img
                    src="static/img/show-more.png" class="showMore"></a>
                <ul class="secNavBar_ul" style="display: none;">
                  <li><a id="page3_1" class="second_nav_name" href="#31">查询登记</a></li>
                  <li><a id="page5_1" class="second_nav_name" href="#51">入住信息</a></li>
                  <li><a id="page5_2" class="second_nav_name active" href="#52">顾客信息</a></li>
                  <li><a id="page5_3" class="second_nav_name" href="#53">预约信息</a></li>
                </ul>
              </li>
              <li id="page6"><a class="first_nav_name" onclick="navSwitchShowmore('page6')"><span>楼层管理</span><img
                    src="static/img/show-more.png" class="showMore"></a>
                <ul class="secNavBar_ul">
                  <li><a id="page6_1" class="second_nav_name" href="#61">楼层管理</a></li>
                  <li><a id="page6_2" class="second_nav_name" href="#62">楼层管理</a></li>
                  <li><a id="page6_3" class="second_nav_name" href="#63">楼层管理</a></li>
                </ul>
              </li>
              <li id="page7"><a class="first_nav_name" onclick="navSwitchShowmore('page7')"><span>人员管理</span><img
                    src="static/img/show-more.png" class="showMore"></a>
                <ul class="secNavBar_ul">
                  <li><a id="page7_1" class="second_nav_name" href="#71">客户信息</a></li>
                  <li><a id="page7_2" class="second_nav_name" href="#72">工作人员</a></li>
                </ul>
              </li>
              <li id="page8"><a class="first_nav_name" onclick="navSwitchShowmore('page8')"><span>系统设置</span><img
                    src="static/img/show-more.png" class="showMore"></a>
                <ul class="secNavBar_ul">
                  <li><a id="page8_1" class="second_nav_name" href="#81">修改密码</a></li>
                  <li><a id="page8_2" class="second_nav_name" href="/logout">退出系统</a></li>
                  <li><a id="page8_3" class="second_nav_name" href="/logout">切换用户</a></li>
                  <li><a id="page8_4" class="second_nav_name" href="/about">关于我们</a></li>
                </ul>
              </li>
            </ul>
          </div>
        </div>
      <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <h1 class="page-header">房间概览</h1>
        <div>
          <ul id="menu">
            <li><span style="background-color: #ef8535;">空房</span></li>
            <li><span style="background-color: #b3c6e5;">已预订</span></li>
            <li><span style="background-color: #3a76af;">已入住</span></li>
          </ul>
        </div>

        <div class="row placeholders">
          <div class="col-xs-6 col-sm-3 placeholder">
            <div id="map0" style="margin-left:-20px;"></div>
            <h4 style="margin-top:-40px;">标准间</h4>
          </div>
          <div class="col-xs-6 col-sm-3 placeholder">
            <div id="map1" style="margin-left:-20px;"></div>
            <h4 style="margin-top:-40px;">大床房</h4>
          </div>
          <div class="col-xs-6 col-sm-3 placeholder">
            <div id="map2" style="margin-left:-20px;"></div>
            <h4 style="margin-top:-40px;">商务双人间</h4>
          </div>
          <div class="col-xs-6 col-sm-3 placeholder">
            <div id="map3" style="margin-left:-20px;"></div>
            <h4 style="margin-top:-40px;">豪华大床房</h4>
          </div>
        </div>

        <h2 class="sub-header">入住详情</h2>
        <div class="table-responsive">
          <table class="table table-striped">
            <thead>
              <tr>
                <th>房间号</th>
                <th>房间类型</th>
                <th>房间状态</th>
                <th>入住人数</th>
                <th>入住时间</th>
                <th>预计离开时间</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>1,001</td>
                <td>标准间</td>
                <td>Lorem</td>
                <td>ipsum</td>
                <td>dolor</td>
                <td>sit</td>
              </tr>
              <tr>
                <td>1,002</td>
                <td>标准间</td>
                <td>amet</td>
                <td>consectetur</td>
                <td>adipiscing</td>
                <td>elit</td>
              </tr>
              <tr>
                <td>1,003</td>
                <td>标准间</td>
                <td>Integer</td>
                <td>nec</td>
                <td>odio</td>
                <td>Praesent</td>
              </tr>
              <tr>
                <td>1,003</td>
                <td>标准间</td>
                <td>libero</td>
                <td>Sed</td>
                <td>cursus</td>
                <td>ante</td>
              </tr>
              <tr>
                <td>1,004</td>
                <td>标准间</td>
                <td>dapibus</td>
                <td>diam</td>
                <td>Sed</td>
                <td>nisi</td>
              </tr>
              <tr>
                <td>1,005</td>
                <td>标准间</td>
                <td>Nulla</td>
                <td>quis</td>
                <td>sem</td>
                <td>at</td>
              </tr>
              <tr>
                <td>1,006</td>
                <td>标准间</td>
                <td>nibh</td>
                <td>elementum</td>
                <td>imperdiet</td>
                <td>Duis</td>
              </tr>
              <tr>
                <td>1,007</td>
                <td>标准间</td>
                <td>sagittis</td>
                <td>ipsum</td>
                <td>Praesent</td>
                <td>mauris</td>
              </tr>
              <tr>
                <td>1,008</td>
                <td>标准间</td>
                <td>Fusce</td>
                <td>nec</td>
                <td>tellus</td>
                <td>sed</td>
              </tr>
              <tr>
                <td>1,009</td>
                <td>标准间</td>
                <td>augue</td>
                <td>semper</td>
                <td>porta</td>
                <td>Mauris</td>
              </tr>
              <tr>
                <td>1,010</td>
                <td>标准间</td>
                <td>massa</td>
                <td>Vestibulum</td>
                <td>lacinia</td>
                <td>arcu</td>
              </tr>
              <tr>
                <td>1,011</td>
                <td>标准间</td>
                <td>eget</td>
                <td>nulla</td>
                <td>Class</td>
                <td>aptent</td>
              </tr>
              <tr>
                <td>1,012</td>
                <td>标准间</td>
                <td>taciti</td>
                <td>sociosqu</td>
                <td>ad</td>
                <td>litora</td>
              </tr>
              <tr>
                <td>1,013</td>
                <td>标准间</td>
                <td>torquent</td>
                <td>per</td>
                <td>conubia</td>
                <td>nostra</td>
              </tr>
              <tr>
                <td>1,014</td>
                <td>标准间</td>
                <td>per</td>
                <td>inceptos</td>
                <td>himenaeos</td>
                <td>Curabitur</td>
              </tr>
              <tr>
                <td>1,015</td>
                <td>标准间</td>
                <td>sodales</td>
                <td>ligula</td>
                <td>in</td>
                <td>libero</td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>


  <script type="text/javascript">
    var arr = [
      [
        ['已入住', 10],
        ['已预订', 15],
        ['空房', 20]
      ],
      [
        ['已入住', 5],
        ['已预订', 10],
        ['空房', 30]
      ],
      [
        ['已入住', 15],
        ['已预订', 12],
        ['空房', 20]
      ],
      [
        ['已入住', 8],
        ['已预订', 3],
        ['空房', 10]
      ]
    ]
    //确定初始数据
    for (var j = 0; j < arr.length; j++) {
      var width = 300; //设置svg区域的宽度
      var height = 300; //设置svg区域的高度

      var svg = d3.select('body') //选择body区
        .selectAll('#map' + j)
        .append('svg') //在body中添加svg
        .attr('width', width) //将宽度赋给width属性
        .attr('height', height); //将高度赋给height属性

      var dataset = arr[j];

      //转换数据
      var pie = d3.layout.pie()
        .value(function (d) {
          return d[1];
        });
      var piedata = pie(dataset);
      console.log(piedata);

      //外半径和内半径
      var outerRadius = width / 3;
      var innerRadius = 0;

      //创建弧生成器
      var arc = d3.svg.arc()
        .innerRadius(innerRadius)
        .outerRadius(outerRadius);
      var color = d3.scale.category20();

      //添加对应数目的弧组，即<g>元素
      var arcs = svg.selectAll('g')
        .data(piedata)
        .enter()
        .append('g')
        .attr('transform', 'translate(' + (width / 2) + ',' + (height / 2) + ')');

      //添加弧的路径元素
      arcs.append('path')
        .attr('fill', function (d, i) {
          return color(i); //设定弧的颜色
        })
        .attr('d', function (d) {
          return arc(d); //使用弧生成器
        });


      //添加弧内的文字元素
      arcs.append('text')
        .attr('transform', function (d) {
          var x = arc.centroid(d)[0] * 1.4; //文字的x坐标
          var y = arc.centroid(d)[1] * 1.4; //文字的y坐标
          return 'translate(' + x + ',' + y + ')';
        })
        .attr('text-anchor', 'middle')
        .text(function (d) {
          //计算市场份额和百分比
          //   var percent = Number(d.value) / d3.sum(dataset, function(d) { return d[1]; }) * 100;
          //保留一个小数点，末尾加一个百分号返回
          //   return percent.toFixed(1) + '%';
          return Number(d.value) + '间';
        });
    }
  </script>

  <!-- Bootstrap core JavaScript
    ================================================== -->
  <!-- Placed at the end of the document so the pages load faster -->
  <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
  <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

</body>

</html>